<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>坏了的计算器</title>
</head>
<body>
  <script>
    function fn(startValue, target) {
      // a -> 2a
      // a -> a-1
      // d[8] -> d[4] + 1;
      // d[7] -> d[4] + 2;
      if (target <= startValue) return startValue - target;
      if (target % 2 === 0) return brokenCalc(startValue, target / 2 ) + 1;
      else return fn(startValue, (target+1)/2) + 2;
    }
    console.log(fn(2, 3))
  </script>
</body>
</html>